---
apiVersion: v1
kind: ConfigMap
metadata:
  name: fluentd-forward-config
  labels:
    log-app: fluentd-forward
data:
  fluent.conf: |
    <system>
      #log_level debug
      log_level info
    </system>

    <source>
      @type  forward
      #@id input
      port  24224
    </source>

    <match sysapp.**>
      @type copy
      <store>
        @type file
        path /fluentd/log/logs/${app}/%Y-%m-%d/${host}/${file}
        append true
        format json
        compress gzip
        add_path_suffix false
        <buffer time,host,file,app>
          @type file
          path /fluentd/log/buffers/sysapp
          chunk_limit_size "8M"
          flush_interval 5s
          flush_mode interval
          flush_thread_count 4
          overflow_action block
          queue_limit_length "8"
          retry_forever
          retry_max_interval 30
          retry_type exponential_backoff
        </buffer>
      </store>
    </match>

    <match kube.{kubesystem,nfs-client,monitoring,ingress-nginx}.**>
      @type copy
      <store>
        @type file
        path /fluentd/log/logs/kube-system/${$.kubernetes.namespace_name}/%Y-%m-%d/${$.kubernetes.container_name}
        append true
        format json
        compress gzip
        add_path_suffix false
        <buffer time,$.kubernetes.namespace_name,$.kubernetes.container_name>
          @type file
          path /fluentd/log/buffers/kube-system
          chunk_limit_size "8M"
          flush_interval 5s
          flush_mode interval
          flush_thread_count 4
          overflow_action block
          queue_limit_length "8"
          retry_forever
          retry_max_interval 30
          retry_type exponential_backoff
        </buffer>
      </store>
    </match>
